<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 从数组中随机娶一个值 

        // 分析：数组取值是通过下标来取的 --- 随机取值就变成了随机取下标

        var arr = ['叶开' , '江志龙' , '丁宇' ,'金宇' ,'陈智' ,'左泽' ,'方正'] ;

        // 随机取下标
        var index = rand(0 , arr.length) ;  // 取不到最大值

        document.write(arr[index]) ;




        function rand(min , max) {
            return parseInt(Math.random() * (max - min)) + min ;
        } 

    </script>
    
</body>
</html>